library("plotly")
## Loading required package: ggplot2
## 
## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2':
## 
##     last_plot
## The following object is masked from 'package:stats':
## 
##     filter
## The following object is masked from 'package:graphics':
## 
##     layout
## Loading required package: ggplot2
## 
## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2':
## 
##     last_plot
## The following object is masked from 'package:stats':
## 
##     filter
## The following object is masked from 'package:graphics':
## 
##     layout
library(dplyr)
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
x = c(1,2,3,4,5)
y = c(1,2,3,4,5)
z = rbind(
  c(0, 1, 0, 1, 0),
  c(1, 0, 1, 0, 1),
  c(0, 1, 0, 1, 0),
  c(1, 0, 1, 0, 1),
  c(0, 1, 0, 1, 0))
plot_ly(type="surface", contours = list(
  x = list(show=TRUE, start = 1.5, end = 2, size = 0.04, # siz sẽ cho ra mật độ
           color="white"),
  z = list(show=TRUE, start = 0.5, end = 0.8, size = 0.05, color="white")
), x=~x, y=~y, z=~z
)